
ac.skill('生命汲取'){
    temp = '攻击触发',
    model1 = [[1a76357b8a2b6fd7.mdl]],
    on_run = function(self,hero,target)
        local num = 5 + math.floor(hero:get('弹射次数') / 2)
        local damage = self:dmg_get()
        ac.timer(500,3,function()
            local group = ac.selector('unit'):range(target,600):enemy(hero):get(num)
            for _,unit in ipairs(group) do
                ac.lightning({
                    id = '生命汲取',
                    from = hero,
                    to = unit,
                    time = 0.3
                })
                ac.wait(150,function()
                    local dmg = hero:create_damage(unit,damage,self)
                    if dmg then
                        hero:heal(dmg.real_damage * 0.05)
                    end
                end)
            end
        end):on_timer()
    end
}

local buff = ac.buff['生命汲取-效果']
buff.time = 1.51
buff.pulse = 0.5

function buff:on_add()
    local source = self.source
    local target = self.owner
    self:gc(ac.lightning({
        id = '生命汲取',
        from = source,
        to = target,
    }))
    self:gc(source:event '单位-死亡'(function()
        self:remove()
    end))
end

function buff:on_pulse()
    local damage = self.damage
    local source = self.source
    local dmg = source:create_damage(self.owner,damage,self.skill)
    if dmg then
        source:heal(dmg.real_damage * 0.05)
    end
end